<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.thymeleaf.org/thymeleaf-extras-shiro">
<head>
    <meta charset="utf-8">
    <title>Layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}" media="all">
    <script th:src="@{/layui/layui.js}" charset="utf-8"></script>
    <script th:src="@{/js/jquery-2.2.3.min.js}" charset="utf-8"></script>
    <link rel="shortcut icon" href="../resources/favicon.ico" th:href="@{/static/favicon.ico}"/>

</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend th:text="${forum.title}"></legend>
</fieldset>
<div  style="display: none">
    <input type="number" name="forumid" id="forumid" th:value="${forum.id}">
</div>
<div class="layui-bg-gray" style="padding: 30px;">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body" th:text="${forum.content}">
                    卡片式面板面板通常用于非白色背景色的主体内<br>
                    从而映衬出边框投影
                </div>


            </div>
        </div>

    </div>
</div>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>评论</legend>
</fieldset>


<div class="layui-bg-gray" style="padding: 15px;">
    <div class="layui-row ">
        <div class="layui-col-md12">
            <div class="layui-card" th:each="comment:${commentlist}" style="margin-top: 8px">

                <div class="layui-card-body" th:text="${comment.content}">
                    卡片式面板面板通常用于非白色背景色的主体内<br>
                    从而映衬出边框投影
                </div>
                <div class="layui-card-header" th:text="${comment.author}"
                >小张</div>
            </div>
        </div>

    </div>
</div>

<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>留言板</legend>
</fieldset>

<div class="container-inner">

    <div class="textarea-wrap message" id="textarea-wrap">
        <form class="layui-form blog-editor" action="">
            <div class="layui-form-item">
                <textarea     name="content" id="content" style="width: 1000px;height: 100px" ></textarea>
            </div>
            <div class="layui-form-item">
                <button class="layui-btn"  onclick="tijiao()">提交留言</button>
            </div>
        </form>
    </div>
</div>

<script>


function tijiao(){
    var content=$("#content").val();
    var forumid=$("#forumid").val();
    console.log(forumid);
    var forumid2=parseInt(forumid);

            $.ajax({
                url: '/support/commentlistadd',
                type: "POST",
                traditional: true,
                data: {
                    "content": content,
                    "forumid": forumid2,
                },
                success: function () {
                    layer.msg('留言成功');
                    window.location.href = '/support/forumdetail/'+forumid2;
                    window.event.returnValue=false;
                }
            });

}



</script>

</body>
</html>